package leetcode.dfs;

import leetcode.dfs.common.DFSUtils;
import leetcode.tree.common.TreeNode;
import leetcode.tree.common.TreeUtils;

/**
 * Definition for a binary tree node.
 * public class TreeNode {
 *     int val;
 *     TreeNode left;
 *     TreeNode right;
 *     TreeNode() {}
 *     TreeNode(int val) { this.val = val; }
 *     TreeNode(int val, TreeNode left, TreeNode right) {
 *         this.val = val;
 *         this.left = left;
 *         this.right = right;
 *     }
 * }
 */
class Solution129 {
    public int sumNumbers(TreeNode root) {
        return DFSUtils.sumNumbers(root);
    }
}

public class leetcode129 {
    public static void main(String[] args) {
        Solution129 solution129 = new Solution129();
        Integer[] nums = {1,2,3};
        Integer[] nums1 = {4,9,0,5,1};
        System.out.println(solution129.sumNumbers(TreeUtils.generateLeetcodeTree(nums)));
        System.out.println(solution129.sumNumbers(TreeUtils.generateLeetcodeTree(nums1)));
    }
}
